package cate.game.activity.sevendaytrial.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.sevendaytrial.SevenDayTrialActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBSevenTrial;
import easy.java.dev.note.NoteField;

/**
 * 七日试炼-领取积分奖励 请求
 *
 * @author ShenSL
 * @since 2023/10/18 20:56
 */
@ClientMsg(title = "七日试炼-领取积分奖励 请求")
public class SevenDayTrialGetProgressRewardReq implements MsgInput {
    @NoteField("功能ID")
    public int funcId;
    @NoteField("领取的奖励天数")
    public int day;

    @Override
    public MsgConfig conf() {
        return MsgIdBSevenTrial.SEVEN_DAY_TRIAL_GET_PROGRESS_REWARD_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        SevenDayTrialActivity single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            game.notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<Void> r = single.onGetTargetReward(day);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }
}
